<template>
  <div class="live">
    <search-header :type="type"></search-header>
    <swiper :imgList="imgList" @jump="jump"></swiper>
    <hot-live :liveList="liveList" @jump="jump"></hot-live>
  </div>
</template>

<script>
  import searchHeader from '@/components/header/searchHeader'
  import Swiper from '@/components/swiper/Swiper'
  import HotLive from '../../../components/list/hotLive'
  import axios from 'axios'
  import {Toast} from 'vant';

  export default {
    name: "live",
    data() {
      return {
        imgList: "",
        liveList: "",
        type: 'live'
      }
    },
    components: {
      HotLive,
      searchHeader,
      Swiper
    },
    mounted() {
      this.getswiperInfo('/api/activelist/banner');
      this.getlistInfo('/api/activelist');
    },
    methods: {
      jump(id, status) {
        if (status === 1) {
          Toast("重播页面还在搭建中哦！");
        }
        if (status === 2) {
          Toast("重播页面还在搭建中哦！");
        }
        if (status === 3) {
          this.$router.push({"name": "detailLive", params: {id: id, status: status}})
        }
      },
      getswiperInfo(url) {
        let that = this
        axios.get(url).then(function (res) {
          if (res.data) {
            that.imgList = res.data.data
          }
        })
      },
      getlistInfo(url) {
        let that = this
        axios.get(url).then(function (res) {
          if (res.data) {
            that.liveList = res.data.data
          }
        })
      }
    },
  }
</script>


